const nodemailer = require("nodemailer");
const userConfig = require('./config.js')
//发送邮件服务器： smtp.qq.com，使用SSL，端口号465或587
const transporter = nodemailer.createTransport({
    host: "smtp.qq.com",
    port: 587,
    secure: false,
    auth: {
        user: userConfig.user,
        pass: userConfig.password,
    },
});

async function send() {
    const info = await transporter.sendMail({
        from: {
            address: 'xxxx@qq.com'
        },
        to: "xxxx@163.com",
        subject: "测试标题",
        text: "测试内容"
    });

    console.log("邮件发送成功：", info.messageId);
}

send().catch(console.error);
